package parser

import (
	"fmt"
	"github.com/go-resty/resty/v2"
	"github.com/goccy/go-json"
	"regexp"
	"strings"
)

type biliParser struct {
}

// 定义完整的响应结构体
type BiliVideoResponse struct {
	Code int `json:"code"`
	Data struct {
		Title string `json:"title"`
		Cover string `json:"cover"`
		Owner struct {
			Mid  string `json:"mid"`
			Name string `json:"name"`
			Face string `json:"face"`
		} `json:"owner"`
		Pages []struct {
			Cover string `json:"cover"`
		} `json:"pages"`
		Dash struct {
			Video []struct {
				BaseUrl   string   `json:"base_url"`
				BackupUrl []string `json:"backup_url"`
				Codecs    string   `json:"codecs"`
				Width     int      `json:"width"`
				Height    int      `json:"height"`
			} `json:"video"`
			Audio []struct {
				BaseUrl   string   `json:"base_url"`
				BackupUrl []string `json:"backup_url"`
			} `json:"audio"`
		} `json:"dash"`
	} `json:"data"`
}

func (a biliParser) parseShareUrl(shareUrl string) (*VideoParseInfo, error) {

	if strings.Contains(shareUrl, "b23.tv") {
		client := resty.New()
		resp, err := client.R().
			SetHeader(HttpHeaderUserAgent, "User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1").
			Get(shareUrl)
		if err != nil {
			return nil, err
		}
		// https://www.bilibili.com/video/BV1DhQ6YvE1K?buvid=YD4806D5192EF9AE42A58D92E5866E21F8ED&from_spmid=united.player-video-detail.0.0&is_story_h5=false&mid=uCytJq4QXgdMAhsSaV4GIg%3D%3D&p=1&plat_id=116&share_from=ugc&share_medium=iphone&share_plat=ios&share_session_id=1F24E7A8-0619-4D8A-BE77-B13C2BC83AB4&share_source=COPY&share_tag=s_i&spmid=united.player-video-detail.0.0&timestamp=1742195976&unique_k=MX8vqF3&up_id=29354369
		shareUrl = resp.RawResponse.Request.URL.String()
	}

	// 提取BV号
	bvRe := regexp.MustCompile(`BV([a-zA-Z0-9]{10})`)
	matches := bvRe.FindStringSubmatch(shareUrl)
	if len(matches) < 2 {
		return nil, fmt.Errorf("failed to extract BV ID from share URL")
	}
	bvId := matches[1]

	// 获取CID
	cidUrl := fmt.Sprintf("https://api.bilibili.com/x/player/pagelist?bvid=%s", bvId)
	cidClient := resty.New()
	respCidBody, err := cidClient.R().
		SetHeader(HttpHeaderUserAgent, "User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1").
		Get(cidUrl)

	// 解析JSON
	var cidResp struct {
		Code int `json:"code"`
		Data []struct {
			Cid int `json:"cid"`
		} `json:"data"`
	}
	// {"code":0,"message":"0","ttl":1,
	//"data":[{"cid":28862252584,"page":1,"from":"vupload",
	//"part":"你管这地方叫川西？| 5000km川西大环线旅行攻略","duration":2324,"vid":"","weblink":"","dimension
	//":{"width":3840,"height":2160,"rotate":0},"first_frame":"http://i1.hdslb.com/bfs/storyff/n250314sa761rogvf5x5e3canxh06qyz_firsti.jpg"}]}
	reader := strings.NewReader(respCidBody.String())
	err = json.NewDecoder(reader).Decode(&cidResp)
	if err != nil {
		return nil, err
	}
	if len(cidResp.Data) == 0 || cidResp.Code != 0 {
		return nil, fmt.Errorf("no CID found in response")
	}
	cid := cidResp.Data[0].Cid

	fmt.Println(cid)

	// 获取视频信息
	videoInfoUrl := fmt.Sprintf("https://api.bilibili.com/x/player/playurl?fnval=80&cid=%d&bvid=%s", cid, bvId)
	videoInfoClient := resty.New()
	respVideoInfoBody, err := videoInfoClient.R().
		SetHeader(HttpHeaderUserAgent, "User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1").
		Get(videoInfoUrl)
	if err != nil {
		return nil, err
	}
	// {"code":0,"message":"0","ttl":1,"data":{"from":"local","result":"suee","message":"","quality":32,"format":"flv480","timelength":2323806,"accept_format":"hdflv2,flv,flv720,flv480,flv360","accept_description":["高清 1080P+","高清 1080P","高清 720P","清晰 480P","流畅 360P"],"accept_quality":[112,80,64,32,16],"video_codecid":7,"seek_param":"start","seek_type":"offset","dash":{"duration":2324,"minBufferTime":1.5,"min_buffer_time":1.5,"video":[{"id":32,"baseUrl":"https://xy123x138x84x202xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-100047.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=72903\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=cos\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=3479e4\u0026traceid=trYSsmzooJfEFz_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=1ab46dc4f7b532fcfee04864ea6b5141","base_url":"https://xy123x138x84x202xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-100047.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=72903\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=cos\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=3479e4\u0026traceid=trYSsmzooJfEFz_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=1ab46dc4f7b532fcfee04864ea6b5141","backupUrl":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-100047.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=1ab46dc4f7b532fcfee04864ea6b5141\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=72903\u0026logo=A0020000","https://upos-sz-mirrorcoso1.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-100047.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=coso1bv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=4eca0b14991d24436818df433981a431\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=72903\u0026logo=40000000"],"backup_url":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-100047.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=1ab46dc4f7b532fcfee04864ea6b5141\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=72903\u0026logo=A0020000","https://upos-sz-mirrorcoso1.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-100047.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=coso1bv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=4eca0b14991d24436818df433981a431\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=72903\u0026logo=40000000"],"bandwidth":583011,"mimeType":"video/mp4","mime_type":"video/mp4","codecs":"avc1.64001F","width":852,"height":480,"frameRate":"30.000","frame_rate":"30.000","sar":"N/A","startWithSap":1,"start_with_sap":1,"SegmentBase":{"Initialization":"0-927","indexRange":"928-6539"},"segment_base":{"initialization":"0-927","index_range":"928-6539"},"codecid":7},{"id":32,"baseUrl":"https://xy122x191x18x169xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30033.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=50020\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=e9acd9\u0026traceid=trsiuVerxCYqYC_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=644bb6fe2043e82319ceb661daa16728","base_url":"https://xy122x191x18x169xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30033.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=50020\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=e9acd9\u0026traceid=trsiuVerxCYqYC_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=644bb6fe2043e82319ceb661daa16728","backupUrl":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30033.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=644bb6fe2043e82319ceb661daa16728\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=50020\u0026logo=A0020000","https://upos-sz-mirror08h.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30033.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=08hbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=25581ed29cc410d71c79f2939ce48ada\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=50020\u0026logo=40000000"],"backup_url":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30033.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=644bb6fe2043e82319ceb661daa16728\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=50020\u0026logo=A0020000","https://upos-sz-mirror08h.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30033.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=08hbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=25581ed29cc410d71c79f2939ce48ada\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=50020\u0026logo=40000000"],"bandwidth":400008,"mimeType":"video/mp4","mime_type":"video/mp4","codecs":"hev1.1.6.L120.90","width":852,"height":480,"frameRate":"30.000","frame_rate":"30.000","sar":"N/A","startWithSap":1,"start_with_sap":1,"SegmentBase":{"Initialization":"0-1091","indexRange":"1092-6703"},"segment_base":{"initialization":"0-1091","index_range":"1092-6703"},"codecid":12},{"id":16,"baseUrl":"https://xy182x201x240x107xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-100046.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=37151\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=1e2a3a\u0026traceid=trpwFuqDEdaIEG_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=9a08102107e0e7791f95573852b3a772","base_url":"https://xy182x201x240x107xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-100046.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=37151\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=1e2a3a\u0026traceid=trpwFuqDEdaIEG_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=9a08102107e0e7791f95573852b3a772","backupUrl":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-100046.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=9a08102107e0e7791f95573852b3a772\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=37151\u0026logo=A0020000","https://upos-sz-mirror08h.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-100046.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=08hbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=6e52801b1adffac5f613904ef3e5e28f\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=37151\u0026logo=40000000"],"backup_url":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-100046.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=9a08102107e0e7791f95573852b3a772\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=37151\u0026logo=A0020000","https://upos-sz-mirror08h.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-100046.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=08hbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=6e52801b1adffac5f613904ef3e5e28f\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=37151\u0026logo=40000000"],"bandwidth":297092,"mimeType":"video/mp4","mime_type":"video/mp4","codecs":"avc1.64001E","width":640,"height":360,"frameRate":"30.000","frame_rate":"30.000","sar":"N/A","startWithSap":1,"start_with_sap":1,"SegmentBase":{"Initialization":"0-946","indexRange":"947-6558"},"segment_base":{"initialization":"0-946","index_range":"947-6558"},"codecid":7},{"id":16,"baseUrl":"https://xy120x210x115x14xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30011.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=31051\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=cos\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=f38203\u0026traceid=trAXNdQIGbliII_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=29f68e30c8363e42a86f8fb280ab8988","base_url":"https://xy120x210x115x14xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30011.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=31051\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=cos\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=f38203\u0026traceid=trAXNdQIGbliII_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=29f68e30c8363e42a86f8fb280ab8988","backupUrl":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30011.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=29f68e30c8363e42a86f8fb280ab8988\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=31051\u0026logo=A0020000","https://upos-sz-mirrorcoso1.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30011.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=coso1bv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=3016745d05e0049bfae2b8bfd2aca2b9\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=31051\u0026logo=40000000"],"backup_url":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30011.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=29f68e30c8363e42a86f8fb280ab8988\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=31051\u0026logo=A0020000","https://upos-sz-mirrorcoso1.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30011.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=coso1bv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=3016745d05e0049bfae2b8bfd2aca2b9\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=31051\u0026logo=40000000"],"bandwidth":248306,"mimeType":"video/mp4","mime_type":"video/mp4","codecs":"hev1.1.6.L120.90","width":640,"height":360,"frameRate":"30.000","frame_rate":"30.000","sar":"N/A","startWithSap":1,"start_with_sap":1,"SegmentBase":{"Initialization":"0-1103","indexRange":"1104-6715"},"segment_base":{"initialization":"0-1103","index_range":"1104-6715"},"codecid":12}],"audio":[{"id":30280,"baseUrl":"https://xy36x163x193x112xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30280.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=12520\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=d71fa5\u0026traceid=trbmYhDhPHgRBi_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=d2ef2e99c9074cd14ddf6f107c2ff18e","base_url":"https://xy36x163x193x112xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30280.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=12520\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=d71fa5\u0026traceid=trbmYhDhPHgRBi_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=d2ef2e99c9074cd14ddf6f107c2ff18e","backupUrl":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30280.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=d2ef2e99c9074cd14ddf6f107c2ff18e\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=A0020000","https://upos-sz-mirror08h.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30280.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=08hbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=0a86b3877a26429af7d3aaa715472296\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=40000000"],"backup_url":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30280.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=d2ef2e99c9074cd14ddf6f107c2ff18e\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=A0020000","https://upos-sz-mirror08h.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30280.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=08hbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=0a86b3877a26429af7d3aaa715472296\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=40000000"],"bandwidth":100106,"mimeType":"audio/mp4","mime_type":"audio/mp4","codecs":"mp4a.40.2","width":0,"height":0,"frameRate":"","frame_rate":"","sar":"","startWithSap":0,"start_with_sap":0,"SegmentBase":{"Initialization":"0-817","indexRange":"818-6429"},"segment_base":{"initialization":"0-817","index_range":"818-6429"},"codecid":0},{"id":30216,"baseUrl":"https://xy221x11x96x56xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30216.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=6365\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=cos\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=3661e8\u0026traceid=trnXbIxcQcEwjE_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=e731be87d4982da661c6a32ebab1b3ca","base_url":"https://xy221x11x96x56xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30216.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=6365\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=cos\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=3661e8\u0026traceid=trnXbIxcQcEwjE_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=e731be87d4982da661c6a32ebab1b3ca","backupUrl":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30216.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=e731be87d4982da661c6a32ebab1b3ca\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=6365\u0026logo=A0020000","https://upos-sz-estgoss.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30216.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=upos\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=eb5c442a8c882c38b246eaff42e014ae\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=6365\u0026logo=40000000"],"backup_url":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30216.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=e731be87d4982da661c6a32ebab1b3ca\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=6365\u0026logo=A0020000","https://upos-sz-estgoss.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30216.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=upos\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=cos\u0026upsig=eb5c442a8c882c38b246eaff42e014ae\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=6365\u0026logo=40000000"],"bandwidth":50880,"mimeType":"audio/mp4","mime_type":"audio/mp4","codecs":"mp4a.40.5","width":0,"height":0,"frameRate":"","frame_rate":"","sar":"","startWithSap":0,"start_with_sap":0,"SegmentBase":{"Initialization":"0-826","indexRange":"827-6438"},"segment_base":{"initialization":"0-826","index_range":"827-6438"},"codecid":0},{"id":30232,"baseUrl":"https://xy221x11x96x56xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30232.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=12520\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=3238db\u0026traceid=trejKaGpFUEETt_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=45c62f0217203f066d7588e328c623a6","base_url":"https://xy221x11x96x56xy.mcdn.bilivideo.cn:8082/v1/resource/28862252584-1-30232.m4s?agrr=1\u0026build=0\u0026buvid=\u0026bvc=vod\u0026bw=12520\u0026deadline=1742214667\u0026e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M%3D\u0026f=u_0_0\u0026gen=playurlv2\u0026logo=A0020000\u0026mcdnid=50009772\u0026mid=0\u0026nbs=1\u0026nettype=0\u0026og=hw\u0026oi=3730455347\u0026orderid=0%2C3\u0026os=mcdn\u0026platform=pc\u0026sign=3238db\u0026traceid=trejKaGpFUEETt_0_e_N\u0026uipk=5\u0026uparams=e%2Cuipk%2Cnbs%2Cdeadline%2Cgen%2Cos%2Coi%2Ctrid%2Cmid%2Cplatform%2Cog\u0026upsig=45c62f0217203f066d7588e328c623a6","backupUrl":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30232.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=45c62f0217203f066d7588e328c623a6\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=A0020000","https://upos-sz-mirrorbd.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30232.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=bdbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=8f3275c62dee7c1b7377c782bc666301\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=40000000"],"backup_url":["https://xy125x211x107x11xy2408y8000y8010yf040yy11xy.mcdn.bilivideo.cn:4483/upgcxcode/84/25/28862252584/28862252584-1-30232.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=mcdn\u0026oi=3730455347\u0026trid=0000dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=45c62f0217203f066d7588e328c623a6\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026mcdnid=50009772\u0026bvc=vod\u0026nettype=0\u0026orderid=0,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=A0020000","https://upos-sz-mirrorbd.bilivideo.com/upgcxcode/84/25/28862252584/28862252584-1-30232.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=\u0026uipk=5\u0026nbs=1\u0026deadline=1742214667\u0026gen=playurlv2\u0026os=bdbv\u0026oi=3730455347\u0026trid=dfa6c609bcea4a688b8a7439f325eb42u\u0026mid=0\u0026platform=pc\u0026og=hw\u0026upsig=8f3275c62dee7c1b7377c782bc666301\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og\u0026bvc=vod\u0026nettype=0\u0026orderid=1,3\u0026buvid=\u0026build=0\u0026f=u_0_0\u0026agrr=1\u0026bw=12520\u0026logo=40000000"],"bandwidth":100106,"mimeType":"audio/mp4","mime_type":"audio/mp4","codecs":"mp4a.40.2","width":0,"height":0,"frameRate":"","frame_rate":"","sar":"","startWithSap":0,"start_with_sap":0,"SegmentBase":{"Initialization":"0-817","indexRange":"818-6429"},"segment_base":{"initialization":"0-817","index_range":"818-6429"},"codecid":0}],"dolby":{"type":0,"audio":null},"flac":null},"support_formats":[{"quality":112,"format":"hdflv2","new_description":"1080P 高码率","display_desc":"1080P","superscript":"高码率","codecs":["avc1.640032","hev1.1.6.L150.90"]},{"quality":80,"format":"flv","new_description":"1080P 高清","display_desc":"1080P","superscript":"","codecs":["avc1.640032","hev1.1.6.L150.90"]},{"quality":64,"format":"flv720","new_description":"720P 高清","display_desc":"720P","superscript":"","codecs":["avc1.640028","hev1.1.6.L120.90"]},{"quality":32,"format":"flv480","new_description":"480P 清晰","display_desc":"480P","superscript":"","codecs":["avc1.64001F","hev1.1.6.L120.90"]},{"quality":16,"format":"flv360","new_description":"360P 流畅","display_desc":"360P","superscript":"","codecs":["avc1.64001E","hev1.1.6.L120.90"]}],"high_format":null,"last_play_time":0,"last_play_cid":0,"view_info":null,"play_conf":{"is_new_description":false}}}
	fmt.Println(respVideoInfoBody)

	var videoResp BiliVideoResponse
	vedioInfoReader := strings.NewReader(respVideoInfoBody.String())
	err = json.NewDecoder(vedioInfoReader).Decode(&videoResp)
	if err != nil {
		return nil, err
	}
	parseInfo := &VideoParseInfo{
		Title:    videoResp.Data.Title,
		CoverUrl: videoResp.Data.Cover,
		Images:   make([]string, 0),
	}

	// 作者信息
	parseInfo.Author.Uid = videoResp.Data.Owner.Mid
	parseInfo.Author.Name = videoResp.Data.Owner.Name
	parseInfo.Author.Avatar = videoResp.Data.Owner.Face

	// 提取所有分P封面
	for _, page := range videoResp.Data.Pages {
		if page.Cover != "" {
			parseInfo.Images = append(parseInfo.Images, page.Cover)
		}
	}

	// 选择最佳画质视频（示例选择第一个）
	if len(videoResp.Data.Dash.Video) > 0 {
		video := videoResp.Data.Dash.Video[0]
		if video.BaseUrl != "" {
			parseInfo.VideoUrl = video.BaseUrl
		} else if len(video.BackupUrl) > 0 {
			parseInfo.VideoUrl = video.BackupUrl[0]
		}
	}

	// 提取音频地址
	if len(videoResp.Data.Dash.Audio) > 0 {
		audio := videoResp.Data.Dash.Audio[0]
		if audio.BaseUrl != "" {
			parseInfo.MusicUrl = audio.BaseUrl
		} else if len(audio.BackupUrl) > 0 {
			parseInfo.MusicUrl = audio.BackupUrl[0]
		}
	}

	// 发送HTTP请求获取页面内容
	//client := resty.New()
	//res, err := client.R().
	//	SetHeader(HttpHeaderUserAgent, "User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1").
	//	Get(shareUrl)
	//if err != nil {
	//	return nil, err
	//}
	//
	//parseInfo := &VideoParseInfo{}
	//
	//videoInfoRe := regexp.MustCompile(`var videoInfo =\s(.*?);`)
	//if findRes := videoInfoRe.FindSubmatch(res.Body()); len(findRes) >= 2 {
	//	jsonStr := strings.TrimSpace(string(findRes[1]))
	//	parseInfo.Title = gjson.Get(jsonStr, "title").String()
	//	parseInfo.CoverUrl = gjson.Get(jsonStr, "cover").String()
	//}
	//playInfoRe := regexp.MustCompile(`var playInfo =\s(.*?);`)
	//if findRes := playInfoRe.FindSubmatch(res.Body()); len(findRes) >= 2 {
	//	jsonStr := strings.TrimSpace(string(findRes[1]))
	//	parseInfo.VideoUrl = gjson.Get(jsonStr, "streams.0.playUrls.0").String()
	//	// 视频地址是m3u8, 可以使用网站 https://tools.thatwind.com/tool/m3u8downloader 下载
	//}

	return parseInfo, nil
}

func (a biliParser) parseVideoID(videoId string) (*VideoParseInfo, error) {
	// acid, 格式: ac36935385
	reqUrl := "https://www.acfun.cn/v/" + videoId
	return a.parseShareUrl(reqUrl)
}
